*&---------------------------------------------------------------------*
*& 包含               ZFIU021_CLS
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
*       CLASS lcl_events DEFINITION
*----------------------------------------------------------------------*
* SALV Event Handler Definition                                        *
*----------------------------------------------------------------------*
CLASS GCL_EVENTS_HANDLER DEFINITION.
  PUBLIC SECTION.
    METHODS:
      ON_LINK_CLICK FOR EVENT LINK_CLICK  "Hotspot Handler
        OF CL_SALV_EVENTS_TABLE
        IMPORTING ROW COLUMN,

      ON_USER_COMMAND FOR EVENT ADDED_FUNCTION OF CL_SALV_EVENTS
        IMPORTING E_SALV_FUNCTION.
ENDCLASS.                    "lcl_events DEFINITION
*
*----------------------------------------------------------------------*
*       CLASS lcl_events IMPLEMENTATION
*----------------------------------------------------------------------*
*  SAL Event Handler Methods                                           *
*----------------------------------------------------------------------*
CLASS GCL_EVENTS_HANDLER IMPLEMENTATION.
  METHOD ON_LINK_CLICK.
    DATA:
      LV_TCODE      TYPE SY-TCODE,
      LS_PARAMETER  TYPE /PTGWFI/PIDVAL,
      LT_PARAMETERS TYPE TABLE OF /PTGWFI/PIDVAL,
      LV_MSG1(80)   TYPE C,
      LV_MSG2(80)   TYPE C.

    READ TABLE GT_RESULT INTO DATA(LS_RESULT) INDEX ROW.

    CASE COLUMN.
      WHEN 'EBELN'.
        IF LS_RESULT-EBELN IS NOT INITIAL.

          LV_TCODE = 'ME23N'.
          MOVE 'BES'      TO LS_PARAMETER-PID.
          MOVE LS_RESULT-EBELN   TO LS_PARAMETER-VALUE.
          APPEND LS_PARAMETER TO LT_PARAMETERS.

          CALL FUNCTION '/PTGWFI/CP_CALLTRANSACTION'
            EXPORTING
              TRAN_CODE             = LV_TCODE
            TABLES
              PID_VAL               = LT_PARAMETERS
            EXCEPTIONS
*             OTHERS                = 1.
* Start of CHG VIMI-18450
              SYSTEM_FAILURE        = 1 MESSAGE LV_MSG1
              COMMUNICATION_FAILURE = 2
              OTHERS                = 3.
          IF SY-SUBRC EQ 1 .
            MESSAGE LV_MSG1 TYPE 'S' DISPLAY LIKE 'E'.

          ELSEIF SY-SUBRC EQ 2 .
            MESSAGE LV_MSG2 TYPE 'S' DISPLAY LIKE 'E'.

          ELSEIF SY-SUBRC = 3.
            MESSAGE I076(/OPT/VIM_M_CLASS).
          ENDIF.
        ENDIF.

      WHEN 'JSDDH'.
        IF LS_RESULT-JSDDH IS NOT INITIAL.
          SET PARAMETER ID 'ZJSDDH' FIELD LS_RESULT-JSDDH.
          CALL TRANSACTION 'ZFIU019_01' AND SKIP FIRST SCREEN.
        ENDIF.

      WHEN 'MBLNR' OR 'MJAHR' OR 'ZEILE'.
        IF LS_RESULT-MBLNR IS NOT INITIAL AND LS_RESULT-MJAHR IS NOT INITIAL.
          SET PARAMETER ID 'MBN' FIELD LS_RESULT-MBLNR.
          SET PARAMETER ID 'MJA' FIELD LS_RESULT-MJAHR.
          CALL FUNCTION 'MIGO_DIALOG'
            EXPORTING
              I_ACTION            = 'A04'
              I_REFDOC            = 'R02'
              I_NOTREE            = 'X'
              I_SKIP_FIRST_SCREEN = 'X'
              I_DEADEND           = 'X'
              I_MBLNR             = LS_RESULT-MBLNR
              I_MJAHR             = LS_RESULT-MJAHR.
        ENDIF.
      WHEN OTHERS.
    ENDCASE.

    CLEAR LS_RESULT.
  ENDMETHOD.                    "on_link_click

  METHOD ON_USER_COMMAND.

    CASE E_SALV_FUNCTION.
      WHEN '&SAVE'.
        PERFORM FRM_BATCH_SAVE_SUBMIT_DATA USING E_SALV_FUNCTION.

      WHEN '&SUBMIT'.
        PERFORM FRM_BATCH_SAVE_SUBMIT_DATA USING E_SALV_FUNCTION.

      WHEN OTHERS.
    ENDCASE.
  ENDMETHOD.
ENDCLASS.                    "lcl_events IMPLEMENTATION

DATA: GR_EVENTS_HANDLER TYPE REF TO GCL_EVENTS_HANDLER.
